- if @family
  .box.box-warning
    .box-header
      %h3.box-title= t('people.move.heading', family: @family.name)
    .box-body
      = t('people.move.description_html', family: @family.name, url: url_for(@family))

%p
  = t("search.people_found", count: @search.count)
  - if @logged_in.admin?(:view_hidden_profiles) and params[:show_hidden].nil?
    = t("search.not_showing_hidden_people")

= pagination @people, params: @search_params

- if @people and @people.any?

  - if @logged_in.active?
    %table.table.search-results
      %tr
        %th
        - if @search.business
          %th= t('search.column.business')
          %th= t('search.column.category')
        - else
          %th= sortable_column_heading t('search.column.name'), alternate_sort_param('people.first_name', 'people.last_name'), :all
          %th= sortable_column_heading t('search.column.family'), alternate_sort_param('families.name', 'families.last_name'), :all
        - if show_birthdays?
          %th= t('search.column.birthday')
        %th
        - if show_testimonies?
          %th= t('search.column.testimony')
        - if @family
          %th
      - @people.each do |person|
        %tr.row-with-avatar
          %td.avatar
            = link_to person do
              = avatar_tag person, fallback_to_family: true
          - if @search.business
            %td= link_to person.business_name, person_path(person, business: true)
            %td
              - if person.business_category.present?
                = link_to person.business_category, search_path(business: true, category: person.business_category)
          - else
            %td
              = link_to person.name_and_nick, person
              - unless person.visible?
                %i.fa.fa-lock
            %td
              - if person.family
                = link_to person.family.name, person.family
              - else
                = t('search.no_family')
          - if show_birthdays?
            %td
              - if person.birthday
                = person.birthday.to_s(:date_without_year)
          %td
            = link_to_person_role(person, separator: "<span class='text-gray'> / </span>")
          - if show_testimonies?
            %td
              = truncate_words(person.testimony, length: 50)
              = link_to t('search.results.testimony_read_more'), testimony_person_path(person), class: 'btn btn-xs bg-gray'
          - if @family
            %td
              - unless @family.people.include?(person)
                = link_to family_person_path(@family, person, move_person: true), data: { method: 'put', confirm: t('are_you_sure') }, class: 'btn btn-warning btn-xs' do
                  = icon 'fa fa-arrow-circle-left'
                  = t('people.move.button')
  - else
    -# limited access
    %table.table
      - @people.each do |person|
        %tr
          %td= link_to person.name, person


= pagination @people, params: @search_params
